package enemyObject;

import com.sxt.GameObject;
import com.sxt.GameWin;

import java.awt.*;

/**
 * 敌方子弹
 */
public class EnemyBulletObj extends EnemyObject{
    static int ENEMY_BULLET_WIDTH = 5; //敌方子弹的宽度
    static int ENEMY_BULLET_HEIGHT = 11; //敌方子弹的高度
    //地方子弹伤害
    int BulletDamage=1;
    public EnemyBulletObj() {
        super();
    }

    public EnemyBulletObj(String image, GameWin frame) {
        super(image, frame);
    }

    public EnemyBulletObj(String image, int x, int y, int speedY, GameWin frame,int flag) {
        super(image, x, y, speedY, frame,flag);
    }

    @Override
    public void paintSelf(Graphics s) {
        s.drawImage(image,x,y,null);
        //越界的敌方子弹删除
        if (y>GameWin.WINDOW_HEIGHT){
            x = -GameWin.ENEMY_VANISH_LOCATION_X;
            y = -GameWin.ENEMY_VANISH_LOCATION_Y;
            this.Frame.removeList.add(this);
        }
        y+=speedY;
    }

    @Override
    public Rectangle getRec() {
        return new Rectangle(x,y,ENEMY_BULLET_WIDTH,ENEMY_BULLET_HEIGHT);
    }

    @Override
    public void DeBug() {
        System.out.println("EnemyBulletObj Class");
    }
}
